﻿using Helper;
using HZY.Framework.DependencyInjection;
using Model.Entity;

namespace DAL.Service
{
    public class RouteBtRoleService : BaseService<RouteBtRoleEntity>, IScopedSelfDependency 
    {
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="entities"></param>
        /// <returns></returns>
        public async Task<BaseResult<string>> add(List<RouteBtRoleEntity> entities)
        {
            try
            {
                int res = await DB.SqlSugarClient.Insertable(entities).ExecuteCommandAsync();
                if (res > 0)
                {
                    return new BaseResult<string>
                    {
                        Code = SystemEnums.ResCode.Success,
                        Data = "",
                        Msg = ""
                    };
                }
                return new BaseResult<string>
                {
                    Code = SystemEnums.ResCode.Fail,
                    Data = "",
                    Msg = "插入失败"
                };
            }
            catch (Exception ex)
            {
                return new BaseResult<string>
                {
                    Code = SystemEnums.ResCode.Fail,
                    Data = "",
                    Msg = ex.Message
                };
            }
        }
    }
}
